using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class LZMAMission_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(global::LZMAMission);
            args = new Type[]{};
            method = type.GetMethod("get_Done", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Done_0);
            args = new Type[]{};
            method = type.GetMethod("get_Progress", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Progress_1);
            args = new Type[]{};
            method = type.GetMethod("get_Running", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Running_2);
            args = new Type[]{};
            method = type.GetMethod("Run", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Run_3);

            field = type.GetField("decoder", flag);
            app.RegisterCLRFieldGetter(field, get_decoder_0);
            app.RegisterCLRFieldSetter(field, set_decoder_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_decoder_0, AssignFromStack_decoder_0);
            field = type.GetField("filePath", flag);
            app.RegisterCLRFieldGetter(field, get_filePath_1);
            app.RegisterCLRFieldSetter(field, set_filePath_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_filePath_1, AssignFromStack_filePath_1);
            field = type.GetField("savePath", flag);
            app.RegisterCLRFieldGetter(field, get_savePath_2);
            app.RegisterCLRFieldSetter(field, set_savePath_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_savePath_2, AssignFromStack_savePath_2);


            app.RegisterCLRCreateDefaultInstance(type, () => new global::LZMAMission());
            app.RegisterCLRCreateArrayInstance(type, s => new global::LZMAMission[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* get_Done_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::LZMAMission instance_of_this_method = (global::LZMAMission)typeof(global::LZMAMission).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Done;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* get_Progress_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::LZMAMission instance_of_this_method = (global::LZMAMission)typeof(global::LZMAMission).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Progress;

            __ret->ObjectType = ObjectTypes.Float;
            *(float*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* get_Running_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::LZMAMission instance_of_this_method = (global::LZMAMission)typeof(global::LZMAMission).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Running;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* Run_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::LZMAMission instance_of_this_method = (global::LZMAMission)typeof(global::LZMAMission).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Run();

            return __ret;
        }


        static object get_decoder_0(ref object o)
        {
            return ((global::LZMAMission)o).decoder;
        }

        static StackObject* CopyToStack_decoder_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((global::LZMAMission)o).decoder;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_decoder_0(ref object o, object v)
        {
            ((global::LZMAMission)o).decoder = (SevenZip.Compression.LZMA.Decoder)v;
        }

        static StackObject* AssignFromStack_decoder_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            SevenZip.Compression.LZMA.Decoder @decoder = (SevenZip.Compression.LZMA.Decoder)typeof(SevenZip.Compression.LZMA.Decoder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((global::LZMAMission)o).decoder = @decoder;
            return ptr_of_this_method;
        }

        static object get_filePath_1(ref object o)
        {
            return ((global::LZMAMission)o).filePath;
        }

        static StackObject* CopyToStack_filePath_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((global::LZMAMission)o).filePath;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_filePath_1(ref object o, object v)
        {
            ((global::LZMAMission)o).filePath = (System.String)v;
        }

        static StackObject* AssignFromStack_filePath_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @filePath = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((global::LZMAMission)o).filePath = @filePath;
            return ptr_of_this_method;
        }

        static object get_savePath_2(ref object o)
        {
            return ((global::LZMAMission)o).savePath;
        }

        static StackObject* CopyToStack_savePath_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((global::LZMAMission)o).savePath;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_savePath_2(ref object o, object v)
        {
            ((global::LZMAMission)o).savePath = (System.String)v;
        }

        static StackObject* AssignFromStack_savePath_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @savePath = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((global::LZMAMission)o).savePath = @savePath;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new global::LZMAMission();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
